<!-- header -->
<%
	if( request.getAttribute("storyid") == null) {
		response.sendRedirect("/writeonproject/home?page=browse_stories");
	}
	String storyid = (String)request.getAttribute("storyid");
	String title = (String)request.getAttribute("storytitle");
%>
	<jsp:include page="header.jsp"> 
	<jsp:param name="title" value="<%=title %>"/>
	</jsp:include>
	
<script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script>


<script type="text/javascript" src="js/dictionary.js"></script>
<script type="text/javascript" src="js/story_view.js"></script>
<script type="text/javascript" src="js/updates.js"></script>
<script type="text/javascript" src="js/tags.js"></script>
<script> window.onload=function() {loadTagContainer();  updateTags(); updateStoryViewInit();}</script>

<!-- / header -->

<!-- content -->
	<div class="body7">
		<div class="main">
			<section id="content">
				<div class="wrapper story_view">
					<article class="col2">
						<div class="pad1">
							<%="<h2>" + title + "</h2>"%>
							<% 
								if ( request.getAttribute("userid") != null ) {
								    out.print("<a href=\"\" id=\"upvote\" onClick=\"upvoteStory(); return false;\" " + 
										"class=\"button shrink\"><span><span>+1</span></span></a> ");
								    out.print("<a href=\"\" id=\"subscribe\" onClick=\"subscribeStory(); return false;\" " + 
										"class=\"button shrink\"><span><span>Subscribe</span></span></a> ");
								    out.print("<a href=\"\" id=\"add\" onClick=\"addStory(); return false;\" " + 
										"class=\"button shrink\"><span><span>Add</span></span></a>");
								}
							 %>
							<br>
						
							<%= "<input type=\"hidden\" id=\"storyid\" value=\"" + storyid + "\">" %>

							<table class="story_posts" id="post_table">
								<tr>
									<td class="posts_col1 right_col">Tags</td>
									<td class="posts_col2" id="post_tags">
									</td>
								</tr>
							</table>
							
							<% if( request.getAttribute("userid") != null ) {
								out.print("<h2>Contribute to Story</h2>");	
							} %>
							<div id="create_story">
								<% if (request.getAttribute("userid") == null) {
								    out.print("<br><p>Log in to contribute!</p>");
								}
								
								%>
								<table class="post_table">
									<tr>
										<% if( request.getAttribute("userid") != null ) {
											out.print("<td class=\"post_col1\">Tags</td>");	
										} %>
										
										<td id="tags_list_small">
											<% if( request.getAttribute("userid") != null ) {
													out.print("<div class=\"vscroll_small\" id=\"tag_container\">");
													out.print("</div>");
												}
											%>
										</td>
									</tr>
									<tr>
										<td></td>
										<%
											if( request.getAttribute("userid") != null ) {
												out.print("<td> <div id=\"post_panel\"></div><div id=\"post_text\"></div></td>");	
											}
										%>										
									</tr>
								</table>
							</div>
							<br>
							<% if( request.getAttribute("userid") != null ) {
								out.print("<a href=\"#\" class=\"button\" id=\"post_story\" onClick=\"contributeToStory(); return false;\"><span><span>Contribute</span></span></a>");	
							} %>
						</div>
					</article>
					
					<article class="col1">
						<div id="float">													
							<div class="box1" id="chat_box1"><div class="box1_bot"><div class="box1_top">
								<div class="pad">															
									<h2 class="chat_trigger">Comments</h2>
									<div id="chat">
										<div id="chat_box"></div>									
										<textarea id="text_box" onkeyup="commentSubmit(event);"></textarea>
									</div>
								</div>
							</div></div></div>
							<br>
							<div class="box1" id="dict_box1"><div class="box1_bot"><div class="box1_top">
								<div class="pad">															
									<h2 class="dictionary_trigger">Dictionary</h2>
									<div id="dictionary">
										<div id="dictionary_box"></div>
										<input type="text" id="lookup_box" name="lookup_box"/>
									</div>
								</div>
							</div></div></div>
						</div>
					</article>
				</div>
			</section>
		</div>
	</div>
	<!-- / content -->

<!-- footer -->
<jsp:include page="footer.jsp"/>
<!-- / footer -->